package com.huluobo.a2209mdmdemo.demo

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.unit.dp
import coil.compose.AsyncImage

/**
 *  Created by LC on 2025/2/21.
 *  横纵向布局,输入框,各种button,图片
 */

@Composable
fun Demo01() {
    //横向布局
//    Row (modifier = Modifier.fillMaxWidth(), horizontalArrangement =Arrangement.Center ){
//        Text(
//            //文本
//            text = "Hello $name!",
//            //文本颜色,colorResource 拿到xml中的color
//            color = colorResource(id = R.color.purple_200),
//            //字号
//            fontSize = 22.sp,
//            //字重
//            fontWeight = FontWeight.Black,
//            //字符间距
//            letterSpacing = 13.sp,
//            //文本方向
//            textAlign = TextAlign.Center,
//            //最大行数
//            maxLines = 1,
//            //超出范围后
//            overflow = TextOverflow.Ellipsis
//        )
//        Text(text = "Hello aa")
//        Text(text = "Hello bb")
//    }

//    var name by remember {
//        mutableStateOf("")
//    }
//
//    var password by remember {
//        mutableStateOf("")
//    }
    Column(
        modifier = Modifier
            .fillMaxWidth()
            .padding(20.dp)
    ) {
//        Text(text = "Hello aa", modifier = Modifier.padding(start = 20.dp, end = 20.dp))
//        Text(text = "Hello bb")
//
//        TextField(
//            //输入的值
//            value = name,
//            //当输入值改变的时候
//            onValueChange = { name = it },
//            //输入框的标签,相当于hilt
//            label = {
//                Text(text = "请输入用户名")
//            },
//            //左侧图标
//            leadingIcon = {
//                //Icon 有3种形式,vector的是直接添加系统图标
//                Icon(imageVector = Icons.Default.AccountCircle, contentDescription = "")
//            },
//            //右侧图标
//            trailingIcon = {
//                Icon(
//                    //painter的是添加Drawable的图标
//                    painter = painterResource(id = R.drawable.ic_action_eye),
//                    contentDescription = "",
//                    modifier = Modifier.size(20.dp)
//                )
//            },
//            //边框
//            shape = RoundedCornerShape(20.dp)
//        )
//        OutlinedTextField(value = password, onValueChange = { password = it }, label = {
//            Text(text = "请输入密码")
//        },
//            leadingIcon = {
//                //Icon 有3种形式,vector的是直接添加系统图标
//                Icon(imageVector = Icons.Default.AccountCircle, contentDescription = "")
//            },
//            trailingIcon = {
//                Icon(
//                    //painter的是添加Drawable的图标
//                    painter = painterResource(id = R.drawable.ic_action_eye),
//                    contentDescription = "",
//                    modifier = Modifier.size(20.dp)
//                )
//            },
//            visualTransformation = PasswordVisualTransformation(),
//            shape = RoundedCornerShape(20.dp)
//        )
//
//        Button(onClick = { /*TODO*/ }) {
//            Text(text = "登录")
//        }
//        OutlinedButton(onClick = { /*TODO*/ }) {
//            Text(text = "登录")
//        }
//        ElevatedButton(onClick = { /*TODO*/ }) {
//            Text(text = "登录")
//        }
//        TextButton(onClick = { /*TODO*/ }) {
//            Text(text = "登录")
//        }
//        OutlinedIconButton(onClick = { /*TODO*/ }) {
//            Text(text = "登录")
//        }

//        Image(imageVector = Icons.Default.ArrowBack, contentDescription = "", Modifier.size(40.dp))
//        Image(painter = painterResource(id = R.drawable.icon1868), contentDescription = "", Modifier.clickable {
//            Log.i("TagA", "点击了图片")
//        })

        AsyncImage(
            model = "https://img1.baidu.com/it/u=4214113141,2036563917&fm=253&app=120&size=w931&n=0&f=JPEG&fmt=auto?sec=1729098000&t=0662d2b383091882ccdd43ad060de2a7",
            contentDescription = "这是一张网络图片",
            modifier = Modifier
                .size(200.dp)
                .clip(CircleShape)
        )
    }
}